<?php
	echo date("Y-m-j H:i:s",time());
   $lot=$_GET["lot"];
   $dbName = "sqlsrv:Server=172.31.3.12,1433;Database=emc3030";   //这里是服务器IP地址和数据库名，端口不是默认的话记得改一下
   $dbUser = "sa";    //用户名
   $dbPassword = "TDled!2018";    //登陆密码
   $db = new PDO($dbName, $dbUser, $dbPassword);   
   echo date("Y-m-j H:i:s",time());
   echo "\n";
	$sql = "select id  from sl_bag where  ctype='2' and clotno='".$lot."'";//
	$res = $db->query($sql);
	echo date("Y-m-j H:i:s",time());
	echo "\n";
	$bid="";
	//print_r($res);
	$rdisk="";
	 while ($row = $res->fetch()){
		$bid=$row['id'];
		$sql = "select clotno  from sl_bags where  id= '".$bid."'";//17620T4003-7250613
		$res2 = $db->query($sql);
		//
		$row = null;
		 while ($row = $res2->fetch()){
		  $rdisk.= $row['clotno'].",";
		 }
		 $rdisk.= "|";
	  
	 }
	 echo date("Y-m-j H:i:s",time());
    echo "\n";

	$res = null;
	$res2 = null;
	$db = null;
	
	 print_r($rdisk);
